#include <iostream>
#include <algorithm>
using namespace std;
int arr[10] = {10,9,8,7,6,5,4,3,2,1};
void showArr(int arr[], int from, int to)
{
    cout << endl;
    for (int i = from; i <= to; ++i)
    {
        cout << arr[i] << " ";
    }
}
void reverseArr(int arr[], int from, int to)
{
    //arr[n-i] = arr[i];
    int tmp;
    for (int i = 0; i + from < to - i; ++i)
    {
        tmp = arr[i + from];
        arr[i + from] = arr[to - i];
        arr[to - i] = tmp;
    }
    showArr(arr, from, to);
}
void RRC(int arr[], int from, int to, int num)
{ //循环左移num位
    for (int t = 0; t < num; ++t)
    {
        int tmp = arr[from];
        for (int i = 1; i <= to - from; ++i)
        {
            arr[i - 1 + from] = arr[i + from];
        }
        arr[to] = tmp;
    }
    showArr(arr, from, to);
}
int medianNum(int arr[], int from, int to, int k)
{
    int pivot = arr[(from + to) / 2];
    int i = from, j = to;
    do
    {
        while (i <= j && arr[i] < pivot)
            i++;
        while (i <= j && pivot < arr[j])
            j--;
        if (i <= j)
        {
            swap(arr[i], arr[j]);
            i++, j--;
        }
    } while (i <= j);
    if (k <= j)
        return medianNum(arr, from, j, k);
    else if (i <= k)
        return medianNum(arr, i, to, k);
    else
        return arr[k];
}
int main()
{
    return 0;
}